package com.wgchao.customer;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: FilterConfig
 * @author: wgchao
 * @createTime: 2019/8/9 3:02 PM
 * @Description: TODO
 */
@Configuration
public class FilterConfig {
    /**
     * 拦截器注册
     *
     * @return
     */
    @Bean
    public FilterRegistrationBean myOncePerRequestFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new FescarXidFilter());
        registration.addUrlPatterns("/*");// 拦截路径
        registration.setName("fescarXidFilter");// 拦截器名称
        registration.setOrder(1);// 顺序
        return registration;
    }
}
